//
//  CustomerDetailsViewController.m
//  HondaPro_2
//
//  Created by ht on 13-6-24.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "CustomerDetailsViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "SVProgressHUD.h"
#import "HelpClass.h"
#import "KehuXinZengViewController.h"
@interface CustomerDetailsViewController ()
{
    BOOL _yonghuchoose;
}

@end

@implementation CustomerDetailsViewController
@synthesize previewlabel1 = _previewlabel1;
@synthesize previewlabel2 = _previewlabel2;
@synthesize previewlabel3 = _previewlabel3;
@synthesize previewlabel4 = _previewlabel4;
@synthesize previewlabel5 = _previewlabel5;
@synthesize previewlabel6 = _previewlabel6;
@synthesize previewlabel7 = _previewlabel7;
@synthesize previewlabel9 = _previewlabel9;
@synthesize previewlabel10 = _previewlabel10;
@synthesize previewlabel11 = _previewlabel11;
@synthesize previewlabel12 = _previewlabel12;
@synthesize previewlabel13 = _previewlabel13;
@synthesize previewlabel14 = _previewlabel14;
@synthesize previewlabel15 = _previewlabel15;
@synthesize previewlabel16 = _previewlabel16;
@synthesize previewlabel17 = _previewlabel17;
@synthesize previewlabel18 = _previewlabel18;
@synthesize previewlabel19 = _previewlabel19;
@synthesize previewlabel20 = _previewlabel20;
@synthesize previewlabel21 = _previewlabel21;
@synthesize previewlabel22 = _previewlabel22;
@synthesize previewlabel23 = _previewlabel23;
@synthesize previewlabel24 = _previewlabel24;

@synthesize addViewButton = _addViewButton;

@synthesize customerDataDicionary = _customerDataDicionary;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view setFrame:CGRectMake(0, 0, 800, 500)];
    [SVProgressHUD dismiss];
    
//    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(receive:) name:@"accordingDic" object:nil];
//    //通用代码表的字典
//    self.dicTmp = [HelpClass returnTheDataByJsonFileAndJustForTestWithFileName:@"codeA" andType:@"json"];

    [self loadfixedlabel];
    [self loadlabelPicture];
}
//-(void)receive:(NSNotification *)notification
//{
//    self.customerDataDicionary = (NSMutableDictionary *)notification.object;
//    [self serchPCD];
//    [self loadlabelPicture];
//    self.previewlabel17.text = [self.customerDataDicionary objectForKey:@"hobbies"];
//    self.previewlabel19.text = [self.customerDataDicionary objectForKey:@"originalfactory"];
//    self.previewlabel20.text = [self.customerDataDicionary objectForKey:@"originalcar"];
//
//}
-(void)loadlabelPicture
{
    self.previewlabel1 = [[UILabel alloc]initWithFrame:CGRectMake(160, 140, 140, 25)]; //客户编号
    self.previewlabel1.textColor = [UIColor grayColor];
//    self.previewlabel1.backgroundColor = [UIColor greenColor];
    self.previewlabel1.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel1.text = [self.customerDataDicionary valueForKey:@"customerId"];
    self.previewlabel1.text = _khbhStr;
    [self.view addSubview:self.previewlabel1];
    
    self.previewlabel2 = [[UILabel alloc]initWithFrame:CGRectMake(160, 185, 140, 25)]; //客户名称
    self.previewlabel2.textColor = [UIColor grayColor];
//    self.previewlabel2.backgroundColor = [UIColor redColor];
    self.previewlabel2.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel2.text = [self.customerDataDicionary valueForKey:@"customerName"];
    self.previewlabel2.text = _khmcStr;
    [self.view addSubview:self.previewlabel2];
    
    self.previewlabel3 = [[UILabel alloc]initWithFrame:CGRectMake(160, 230, 140, 25)]; //手机号
    self.previewlabel3.textColor = [UIColor grayColor];
//    self.previewlabel3.backgroundColor = [UIColor redColor];
    self.previewlabel3.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel3.text = [self.customerDataDicionary valueForKey:@"mobile"];
    self.previewlabel3.text =_sjhStr;
    [self.view addSubview:self.previewlabel3];
    
    self.previewlabel4 = [[UILabel alloc]initWithFrame:CGRectMake(160, 275, 140, 25)]; //客户性质
    self.previewlabel4.textColor = [UIColor grayColor];
//    self.previewlabel4.backgroundColor = [UIColor redColor];
    self.previewlabel4.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel4.text =_khxzStr;
//    if([[self.customerDataDicionary valueForKey:@"sourceName"]isEqualToString:@"A1"])
//    {
//        self.previewlabel4.text = @"自然来店";
//    }
//    if([[self.customerDataDicionary valueForKey:@"sourceName"]isEqualToString:@"A2"])
//    {
//        self.previewlabel4.text = @"保有增购/换购";
//    }
//    if([[self.customerDataDicionary valueForKey:@"sourceName"]isEqualToString:@"A3"])
//    {
//        self.previewlabel4.text = @"情报提供";
//    }
//    if([[self.customerDataDicionary valueForKey:@"sourceName"]isEqualToString:@"A4"])
//    {
//        self.previewlabel4.text = @"店外开发";
//    }
//    if([[self.customerDataDicionary valueForKey:@"sourceName"]isEqualToString:@"A5"])
//    {
//        self.previewlabel4.text = @"保有推介";
//    }
    [self.view addSubview:self.previewlabel4];
    
    self.previewlabel5 = [[UILabel alloc]initWithFrame:CGRectMake(160, 320, 140, 25)];//联系人
//    self.previewlabel5.backgroundColor = [UIColor cyanColor];
    self.previewlabel5.textColor = [UIColor grayColor];
    self.previewlabel5.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel5.text = [self.customerDataDicionary valueForKey:@"natureName"];
    self.previewlabel5.text =_lxrStr;
    [self.view addSubview:self.previewlabel5];
    
    self.previewlabel6 = [[UILabel alloc]initWithFrame:CGRectMake(160, 365, 140, 25)];//联系电话
    self.previewlabel6.textColor = [UIColor grayColor];
//    self.previewlabel6.backgroundColor = [UIColor redColor];
    self.previewlabel6.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel6.text = [self.customerDataDicionary valueForKey:@"contactMan"];
    self.previewlabel6.text =_lxdhStr;
    [self.view addSubview:self.previewlabel6];
    
    self.previewlabel7 = [[UILabel alloc]initWithFrame:CGRectMake(160, 410, 200, 25)];//所在地区
//    self.previewlabel7.backgroundColor = [UIColor redColor];
    self.previewlabel7.textColor = [UIColor grayColor];
    self.previewlabel7.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel7.text = [self.customerDataDicionary valueForKey:@"tel"];
    self.previewlabel7.text = _szdqStr;
    [self.view addSubview:self.previewlabel7];
    
//    if([HelpClass isPureInt:[self.customerDataDicionary valueForKey:@"province"]])
//    {
//        //查找省
//        NSMutableArray *container = [[NSMutableArray alloc]init];
//        NSMutableArray *nameS = [[NSMutableArray alloc]init];
//        NSMutableArray *provinceArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"area"]];
//        for(int i = 0; i < [provinceArray count]; i++)
//        {
//            [container addObject:[[provinceArray objectAtIndex:i]objectForKey:@"key"]];
//            [nameS addObject:[[provinceArray objectAtIndex:i] objectForKey:@"value"]];
//        }
//        NSString *str = [nameS objectAtIndex:[container indexOfObject:[self.customerDataDicionary valueForKey:@"province"]]];
//        //查找市
//        NSMutableArray *container2 = [[NSMutableArray alloc]init];
//        NSMutableArray *nameY = [[NSMutableArray alloc]init];
//        NSMutableArray *cityArray = [NSMutableArray arrayWithArray:[[provinceArray objectAtIndex:[container indexOfObject:[self.customerDataDicionary valueForKey:@"province"]]] objectForKey:@"subArea"]];
//        for(int i = 0; i < [cityArray count]; i++)
//        {
//            [container2 addObject:[[cityArray objectAtIndex:i]objectForKey:@"key"]];
//            [nameY addObject:[[cityArray objectAtIndex:i] objectForKey:@"value"]];
//        }
//        NSString *str2 = [nameY objectAtIndex:[container2 indexOfObject:[self.customerDataDicionary valueForKey:@"city"]]];
//        //查找地区
//        NSString *data = [self.customerDataDicionary valueForKey:@"district"];
//        
//        NSString *stringtmp = [data substringFromIndex:data.length-2];
//        if([stringtmp isEqualToString:@"00"])
//        {
//            int intdata = [data intValue];
//            int intdataTmp = intdata+1;
//            NSString *strNew = [NSString stringWithFormat:@"%d",intdataTmp];
//            
//            NSMutableArray *container3 = [[NSMutableArray alloc]init];
//            NSMutableArray *nameD = [[NSMutableArray alloc]init];
//            NSMutableArray *countyArray = [NSMutableArray arrayWithArray:[[cityArray objectAtIndex:[container2 indexOfObject:[self.customerDataDicionary valueForKey:@"city"]]] objectForKey:@"subArea"]];
//            for(int i = 0; i < [countyArray count]; i++)
//            {
//                [container3 addObject:[[countyArray objectAtIndex:i]objectForKey:@"key"]];
//                [nameD addObject:[[countyArray objectAtIndex:i] objectForKey:@"value"]];
//            }
//            NSString *str3 = [nameD objectAtIndex:[container3 indexOfObject:strNew]];
//            
//            NSString *text = [NSString stringWithFormat:@"%@     %@     %@",str,str2,str3];
//            self.previewlabel8 = [[UILabel alloc]initWithFrame:CGRectMake(160, 455, 500, 25)];//所在地区
//            self.previewlabel8.textColor = [UIColor grayColor];
//            self.previewlabel8.font = [UIFont fontWithName:@"ArialMT" size:15];
//            self.previewlabel8.text = text;
//            [self.view addSubview:self.previewlabel8];
//        }
//        else
//        {
//            NSMutableArray *container3 = [[NSMutableArray alloc]init];
//            NSMutableArray *nameD = [[NSMutableArray alloc]init];
//            NSMutableArray *countyArray = [NSMutableArray arrayWithArray:[[cityArray objectAtIndex:[container2 indexOfObject:[self.customerDataDicionary valueForKey:@"city"]]] objectForKey:@"subArea"]];
//            for(int i = 0; i < [countyArray count]; i++)
//            {
//                [container3 addObject:[[countyArray objectAtIndex:i]objectForKey:@"key"]];
//                [nameD addObject:[[countyArray objectAtIndex:i] objectForKey:@"value"]];
//            }
//            NSString *str3 = [nameD objectAtIndex:[container3 indexOfObject:[self.customerDataDicionary valueForKey:@"district"]]];
//            
//            NSString *text = [NSString stringWithFormat:@"%@     %@     %@",str,str2,str3];
//            self.previewlabel8 = [[UILabel alloc]initWithFrame:CGRectMake(160, 455, 500, 25)];//所在地区
//            self.previewlabel8.textColor = [UIColor grayColor];
//            self.previewlabel8.font = [UIFont fontWithName:@"ArialMT" size:15];
//            self.previewlabel8.text = text;
//            [self.view addSubview:self.previewlabel8];
//        }
//
//    }

    
    self.previewlabel9 = [[UILabel alloc]initWithFrame:CGRectMake(470, 140, 385, 25)];//联系地址
//    self.previewlabel9.backgroundColor = [UIColor redColor];
    self.previewlabel9.textColor = [UIColor grayColor];
    self.previewlabel9.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel9.text = _lxdzStr;
    [self.view addSubview:self.previewlabel9];
    
    self.previewlabel10 = [[UILabel alloc]initWithFrame:CGRectMake(470, 185, 140, 25)];//邮编
//    self.previewlabel10.backgroundColor = [UIColor redColor];
    self.previewlabel10.textColor = [UIColor grayColor];
    self.previewlabel10.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel10.text =_ybStr;
    [self.view addSubview:self.previewlabel10];
    
    self.previewlabel11 = [[UILabel alloc]initWithFrame:CGRectMake(470, 230, 140, 25)];//性别
//    self.previewlabel11.backgroundColor = [UIColor redColor];
    self.previewlabel11.textColor = [UIColor grayColor];
    self.previewlabel11.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel11.text = _xbStr;
    [self.view addSubview:self.previewlabel11];
    
    self.previewlabel12 = [[UILabel alloc]initWithFrame:CGRectMake(470, 275, 140, 25)];//出生日期
//    self.previewlabel12.backgroundColor = [UIColor redColor];
    self.previewlabel12.textColor = [UIColor grayColor];
    self.previewlabel12.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel12.text =_csrqStr;
    [self.view addSubview:self.previewlabel12];
    
    
    self.previewlabel13 = [[UILabel alloc]initWithFrame:CGRectMake(470, 320, 140, 25)];//证件类型
//    self.previewlabel13.backgroundColor = [UIColor redColor];
    self.previewlabel13.textColor = [UIColor grayColor];
    self.previewlabel13.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel13.text = _zjlxStr;
    [self.view addSubview:self.previewlabel13];
    
    self.previewlabel14 = [[UILabel alloc]initWithFrame:CGRectMake(470, 365, 230, 25)];//证件号码
    self.previewlabel14.textColor = [UIColor grayColor];
//    self.previewlabel14.backgroundColor = [UIColor redColor];
    self.previewlabel14.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel14.text = _zjhmStr;
    [self.view addSubview:self.previewlabel14];
    
//    self.previewlabel15 = [[UILabel alloc]initWithFrame:CGRectMake(470, 410, 230, 25)];//证件号码
//    self.previewlabel15.textColor = [UIColor grayColor];
//    self.previewlabel15.backgroundColor = [UIColor redColor];
//    self.previewlabel15.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel15.text = [self.customerDataDicionary valueForKey:@"certificate"];
//    [self.view addSubview:self.previewlabel15];
    
    self.previewlabel16 = [[UILabel alloc]initWithFrame:CGRectMake(785, 185, 140, 24)];//兴趣爱好
    self.previewlabel16.textColor = [UIColor grayColor];
//    self.previewlabel16.backgroundColor = [UIColor redColor];
    self.previewlabel16.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel16.text = _xqahStr;
    [self.view addSubview:self.previewlabel16];

//    //兴趣爱好 id转name
//    NSMutableArray *hobbyArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"hobby"]];
//    NSMutableArray *keyArray = [[NSMutableArray alloc]init];
//    NSMutableArray *valueArray = [[NSMutableArray alloc]init];
//    for(int i = 0; i < [hobbyArray count];i++)
//    {
//        [valueArray addObject:[[hobbyArray objectAtIndex:i] objectForKey:@"value"]];
//        [keyArray addObject:[[hobbyArray objectAtIndex:i] objectForKey:@"key"]];
//    }
//    NSString *textP7;
//    if([HelpClass isPureInt:[self.customerDataDicionary valueForKey:@"hobbies"]])
//    {
//        textP7 = [valueArray objectAtIndex:[keyArray indexOfObject:[self.customerDataDicionary valueForKey:@"hobbies"]]];
//    }
    //兴趣爱好
    self.previewlabel17 = [[UILabel alloc]initWithFrame:CGRectMake(785, 230, 140, 24)];//婚姻状况
//    self.previewlabel17.backgroundColor = [UIColor redColor];
    self.previewlabel17.textColor = [UIColor grayColor];
    self.previewlabel17.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel17.text = _hyztStr;
    [self.view addSubview:self.previewlabel17];
    
//    //婚姻状况
//    self.previewlabel18 = [[UILabel alloc]initWithFrame:CGRectMake(785, 275, 140, 24)];//婚姻状况
//    self.previewlabel18.textColor = [UIColor grayColor];
//    self.previewlabel18.backgroundColor = [UIColor redColor];
//    self.previewlabel18.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel18.text = [self.customerDataDicionary valueForKey:@"marital"];
//    [self.view addSubview:self.previewlabel18];


//    //生产厂家id转name
//    NSMutableArray *carShop = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"car_shop"]];
//    NSMutableArray *keyP9 = [[NSMutableArray alloc]init];
//    NSMutableArray *valueP9 = [[NSMutableArray alloc]init];
//    for(int i = 0;i < [carShop count];i++)
//    {
//        [keyP9 addObject:[[carShop objectAtIndex:i]objectForKey:@"key"]];
//        [valueP9 addObject:[[carShop objectAtIndex:i]objectForKey:@"value"]];
//    }
//    NSString *textP9;
//    if([HelpClass isPureInt:[self.customerDataDicionary valueForKey:@"originalfactory"]])
//    {
//        if([keyP9 containsObject:[self.customerDataDicionary valueForKey:@"originalfactory"]])
//        {
//            textP9 = [valueP9 objectAtIndex:[keyP9 indexOfObject:[self.customerDataDicionary valueForKey:@"originalfactory"]]];
//        }
//        else
//        {
//            NSString *str = [self.customerDataDicionary valueForKey:@"originalfactory"];
//            str = @"";
//        }
//    }
//    //生产厂家
//    self.previewlabel19 = [[UILabel alloc]initWithFrame:CGRectMake(785, 320, 140, 24)];
//    self.previewlabel19.textColor = [UIColor grayColor];
//    self.previewlabel19.font = [UIFont fontWithName:@"ArialMT" size:15];
////    self.previewlabel19.text = textP9;
//    self.previewlabel19.backgroundColor = [UIColor redColor];
//    [self.view addSubview:self.previewlabel19];
    
//    //车辆品牌id转name
//    NSMutableArray *keyP10 = [[NSMutableArray alloc]init];
//    NSMutableArray *valueP10 = [[NSMutableArray alloc]init];
//    NSString *textP10;
//    if([HelpClass isPureInt:[self.customerDataDicionary valueForKey:@"originalfactory"]])
//    {
//        if([keyP9 containsObject:[self.customerDataDicionary valueForKey:@"originalfactory"]])
//        {
//            NSMutableArray *brandArray = [NSMutableArray arrayWithArray:[[carShop objectAtIndex:[keyP9 indexOfObject:[self.customerDataDicionary valueForKey:@"originalfactory"]]]objectForKey:@"brand"]];
//            for(int i = 0;i < [brandArray count];i++)
//            {
//                [keyP10 addObject:[[brandArray objectAtIndex:i]objectForKey:@"key"]];
//                [valueP10 addObject:[[brandArray objectAtIndex:i]objectForKey:@"value"]];
//            }
//            if([keyP10 containsObject:[self.customerDataDicionary valueForKey:@"originalcar"]])
//            {
//                textP10 = [valueP10 objectAtIndex:[keyP10 indexOfObject:[self.customerDataDicionary valueForKey:@"originalcar"]]];
//            }
//        }
//        else
//        {
//            NSString *str = [self.customerDataDicionary valueForKey:@"originalfactory"];
//            str = @"";
//        }
//    }
//        self.previewlabel20 = [[UILabel alloc]initWithFrame:CGRectMake(785, 365, 140, 24)];//车辆品牌
//        self.previewlabel20.textColor = [UIColor grayColor];
// 
//        self.previewlabel20.font = [UIFont fontWithName:@"ArialMT" size:15];
//       self.previewlabel20.backgroundColor = [UIColor redColor];
//        [self.view addSubview:self.previewlabel20];
    
    self.previewlabel21 = [[UILabel alloc]initWithFrame:CGRectMake(160, 490-45, 500, 80)];//备注
//    self.previewlabel21.backgroundColor = [UIColor redColor];
    self.previewlabel21.textColor = [UIColor grayColor];
    self.previewlabel21.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel21.text =_bzStr;
    [self.view addSubview:self.previewlabel21];
    
    ///是否协议客户
//    self.yonghu = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.yonghu.enabled=NO;
//    [self.yonghu setFrame:CGRectMake(805, 402, 35, 35)];
////    NSLog(@"%@",self.customerDataDicionary);
//    ///////////////////当添加的字段测可以启用//////////////////////
//    NSString *str3=@"";
//    str3=[self.customerDataDicionary valueForKey:@"ispayclient"];
//    //NSString *str1=@"1";
//    //NSString *str2=@"0";
//    if([str3 isEqualToString:@"0"])
//    {
//        [self.yonghu setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
//    }
//    else if([str3 isEqualToString:@"1"])
//    {
//        [self.yonghu setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
//    }
//    else
//    {
//        [self.yonghu setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
//    }
//        [self.view addSubview:self.yonghu];
    //测试label
//    _ceshi = [[UILabel alloc]initWithFrame:CGRectMake(750, 350, 150, 30)];
//    //_ceshi.text=@"0";
//    _ceshi.hidden=YES;
//    _ceshi.textColor = [UIColor grayColor];
//    [self.view addSubview:_ceshi];
    //编辑按钮
    self.addViewButton = [[UIButton alloc]initWithFrame:CGRectMake(840, 60, 80, 36)];
    [self.addViewButton setTitle:@"编 辑" forState:UIControlStateNormal];
    [self.addViewButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.addViewButton setBackgroundImage:[UIImage imageNamed:@"改-灰but.png"] forState:UIControlStateNormal];
    self.addViewButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.addViewButton addTarget:self action:@selector(addViewButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.addViewButton];
}


#pragma mark -编辑按钮的回调
-(void)addViewButton:(id)sender
{
    KehuXinZengViewController * VC = [[KehuXinZengViewController alloc]init];
    VC.CLStatus = @"bj";
    VC.khbhStr = _khbhStr;
    VC.khmcStr = _khmcStr;
    VC.sjhStr = _sjhStr;
    VC.khxzStr = _khxzStr;
    VC.lxrStr = _lxrStr;
    VC.lxdhStr = _lxdhStr;
    
    NSArray * suozaidiquArr = [_szdqStr componentsSeparatedByString:@" "];
    VC.privenceStr = [suozaidiquArr objectAtIndex:0];
    VC.cityStr = [suozaidiquArr objectAtIndex:1];
    VC.areaStr = [suozaidiquArr objectAtIndex:2];
    VC.lxdzStr = _lxdzStr;
    VC.ybStr = _ybStr;
    VC.xbStr = _xbStr;
    VC.csrqStr = _csrqStr;
    VC.zjlxStr = _zjlxStr;
    VC.zjhmStr = _zjhmStr;
    VC.xqahStr =_xqahStr;
    VC.hyztStr = _hyztStr;
    VC.bzStr = _bzStr;
    [self.navigationController pushViewController:VC  animated:YES];
//    [SVProgressHUD showWithStatus:@"请等待...."];
//    self.customerInsideViewController = [[CustomerInsideViewController alloc]init];
//    NSMutableDictionary *replace = [NSMutableDictionary dictionaryWithDictionary:self.customerDataDicionary];
//    if(self.previewlabel4.text != nil)
//    {
//        [replace setObject:self.previewlabel4.text forKey:@"sourceName"];
//    }
//    if(self.previewlabel17.text != nil)//兴趣爱好
//    {
//        [replace setObject:self.previewlabel17.text forKey:@"hobbies"];
//    }
//    if(self.previewlabel19.text != nil)//生产厂家
//    {
//        [replace setObject:self.previewlabel19.text forKey:@"originalfactory"];
//    }
//    if(self.previewlabel20.text != nil)//
//        
//    {
//        [replace setObject:self.previewlabel20.text forKey:@"originalcar"];
//    }
//    self.customerInsideViewController.customerInsideDit = replace;
//    [self.navigationController pushViewController:self.customerInsideViewController animated:YES];
}
#pragma mark -返回按钮的回调
-(void)CustomBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)loadfixedlabel
{
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setImage:[UIImage imageNamed:@"返回.png"] forState:UIControlStateNormal];
    [backButton setFrame:CGRectMake(70, 35, 45, 60)];
    [backButton addTarget:self action:@selector(CustomBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(20, 105, 1000, 11)];
    image.image = [UIImage imageNamed:@"渐变分割线.png"];
    [self.view addSubview:image];
    UILabel *imagetitel = [[UILabel alloc]initWithFrame:CGRectMake(160, 55, 180, 35)];
    imagetitel.text = @"客户详细资料";
    imagetitel.backgroundColor = [UIColor clearColor];
    imagetitel.textColor = [UIColor grayColor];
    imagetitel.font = [UIFont fontWithName:@"ArialMT" size:28];
    [self.view addSubview:imagetitel];
    
    NSMutableArray *labelMutabelArray = [[NSMutableArray alloc]initWithObjects:@"客户编号:",@"客户名称:",@"手  机  号:",@"客户性质:",@"联  系  人:",@"联系电话:",@"所在地区:",@"备       注:", nil];
    for(int i = 0; i < 8;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(75, (138+i*45), 100, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:16];
        //[titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.view addSubview:titlelabel];
    }
    NSMutableArray *labelMutabelArray2 = [[NSMutableArray alloc]initWithObjects:@"联系地址:",@"邮       编:",@"性       别:",@"出生日期:",@"证件类型:",@"证件号码:", nil];
    for(int i = 0; i < 6;i++)
    {
        UILabel *titlelabel2 = [[UILabel alloc]initWithFrame:CGRectMake(380, (138+i*45), 95, 25)];
        [titlelabel2 setBackgroundColor:[UIColor clearColor]];
        titlelabel2.text = [labelMutabelArray2 objectAtIndex:i];
        titlelabel2.textColor = [UIColor grayColor];
        titlelabel2.font = [UIFont fontWithName:@"ArialMT" size:16];
        [self.view addSubview:titlelabel2];
    }
//    @"职       业:",@"兴趣爱好:",@"婚姻状况:",@"生产厂家:",@"车辆品牌:",@"是否协议客户:"
    NSMutableArray *labelMutabelArray3 = [[NSMutableArray alloc]initWithObjects:@"兴趣爱好",@"婚姻状况", nil];
    for(int i = 0; i < 2;i++)
    {
        UILabel *titlelabel3 = [[UILabel alloc]initWithFrame:CGRectMake(700, (183+i*45), 110, 25)];
        [titlelabel3 setBackgroundColor:[UIColor clearColor]];
        titlelabel3.text = [labelMutabelArray3 objectAtIndex:i];
        titlelabel3.textColor = [UIColor grayColor];
        titlelabel3.font = [UIFont fontWithName:@"ArialMT" size:16];
        [self.view addSubview:titlelabel3];
    }
}
//-(void)removeObserver
//{
//    [[NSNotificationCenter defaultCenter]removeObserver:self name:@"accordingDic" object:nil];
//}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//通过名字查找省市地的Id
-(void)serchPCD
{
//    NSLog(@"他ba的省：%@",[self.customerDataDicionary objectForKey:@"province"]);
//    NSLog(@"他ba的市：%@",[self.customerDataDicionary objectForKey:@"city"]);
//    NSLog(@"他ba的区：%@",[self.customerDataDicionary objectForKey:@"district"]);
    //查找省
    NSMutableArray *container = [[NSMutableArray alloc]init];
    NSMutableArray *nameS = [[NSMutableArray alloc]init];
    NSMutableArray *provinceArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"area"]];
    for(int i = 0; i < [provinceArray count]; i++)
    {
        [container addObject:[[provinceArray objectAtIndex:i]objectForKey:@"key"]];
        [nameS addObject:[[provinceArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str = [container objectAtIndex:[nameS indexOfObject:[self.customerDataDicionary objectForKey:@"province"]]];
    //查找市
    NSMutableArray *container2 = [[NSMutableArray alloc]init];
    NSMutableArray *nameY = [[NSMutableArray alloc]init];
    NSMutableArray *cityArray = [NSMutableArray arrayWithArray:[[provinceArray objectAtIndex:[nameS indexOfObject:[self.customerDataDicionary objectForKey:@"province"]]] objectForKey:@"subArea"]];
    for(int i = 0; i < [cityArray count]; i++)
    {
        [container2 addObject:[[cityArray objectAtIndex:i]objectForKey:@"key"]];
        [nameY addObject:[[cityArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str2 = [container2 objectAtIndex:[nameY indexOfObject:[self.customerDataDicionary objectForKey:@"city"]]];
    //查找地区
    NSMutableArray *container3 = [[NSMutableArray alloc]init];
    NSMutableArray *nameD = [[NSMutableArray alloc]init];
    NSMutableArray *countyArray = [NSMutableArray arrayWithArray:[[cityArray objectAtIndex:[nameY indexOfObject:[self.customerDataDicionary objectForKey:@"city"]]] objectForKey:@"subArea"]];
    for(int i = 0; i < [countyArray count]; i++)
    {
        [container3 addObject:[[countyArray objectAtIndex:i]objectForKey:@"key"]];
        [nameD addObject:[[countyArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str3 = [container3 objectAtIndex:[nameD indexOfObject:[self.customerDataDicionary objectForKey:@"district"]]];
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:self.customerDataDicionary];

    if([[self.customerDataDicionary objectForKey:@"sourceName"] isEqualToString:@"自然来店"])
    {
        [dict setObject:@"A1" forKey:@"sourceName"];
    }
    if([[self.customerDataDicionary objectForKey:@"sourceName"] isEqualToString:@"保有增购/换购"])
    {
        [dict setObject:@"A2" forKey:@"sourceName"];
    }
    if([[self.customerDataDicionary objectForKey:@"sourceName"] isEqualToString:@"情报提供"])
    {
        [dict setObject:@"A3" forKey:@"sourceName"];
    }
    if([[self.customerDataDicionary objectForKey:@"sourceName"] isEqualToString:@"店外开发"])
    {
        [dict setObject:@"A4" forKey:@"sourceName"];
    }
    if([[self.customerDataDicionary objectForKey:@"sourceName"] isEqualToString:@"保有推介"])
    {
        [dict setObject:@"A5" forKey:@"sourceName"];
    }
    [dict setObject:str forKey:@"province"];
    [dict setObject:str2 forKey:@"city"];
    [dict setObject:str3 forKey:@"district"];
    self.customerDataDicionary = dict;
    
//    NSLog(@"他ye的省：%@",[self.customerDataDicionary objectForKey:@"province"]);
//    NSLog(@"他ye的市：%@",[self.customerDataDicionary objectForKey:@"city"]);
//    NSLog(@"他ye的区：%@",[self.customerDataDicionary objectForKey:@"district"]);
    
//    NSLog(@"客户来源：%@",[self.customerDataDicionary objectForKey:@"sourceName"]);
}


@end
